import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class SettingPage extends StatefulWidget {
  const SettingPage({Key key}) : super(key: key);

  @override
  _SettingPageState createState() => _SettingPageState();
}

class _SettingPageState extends State<SettingPage> with SingleTickerProviderStateMixin {
  Animation<double> _animation1;
  AnimationController _controller1;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    _controller1 = new AnimationController(
        duration: const Duration(milliseconds: 1000), vsync: this);
    _animation1 = new Tween(begin: 200.0, end: 210.0).animate(_controller1)
      ..addListener(() {
        setState(() {
          // the state that has changed here is the animation object’s value
        });
      });
    _animation1.addStatusListener((status) {
      if (status == AnimationStatus.completed) {
        _controller1.reverse();
      } else if (status == AnimationStatus.dismissed) {
        _controller1.forward();
      }
    });
    _controller1.forward();
  }

  @override
  void dispose() {
    // TODO: implement dispose

    _controller1.stop();
    _controller1.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: <Widget>[
          // ButtonBar(

          //   children: [
          //     Container(
          //       width: 50,
          //       height: 30,
          //       color: Colors.grey,
          //     )
          //   ],
          // )
        ],
        centerTitle: true,
        title: Text(
          '设置',
          style: TextStyle(
            fontSize: 16,
            color: Color.fromRGBO(72, 72, 72, 1),
            fontWeight: FontWeight.bold,
          ),
        ),
        backgroundColor: Colors.white,
        // backgroundColor: Color.fromRGBO(252, 252, 189, 1),
        elevation: 0,
        iconTheme: IconThemeData(
          color: Colors.black54
        ),
      ),
      body: Stack(
        alignment: Alignment.center,
        children: [
          Positioned(
            // left: 70,
            bottom: _animation1.value,
            child: Container(
              child: Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Image.asset('assets/images/common/device/电脑.png'),
                  ),
                ],
              ),
            ),
          ),
          Container(
            child: Positioned(
              bottom: 170,
              child: Stack(
                children: [
                  Text(
                    'Welcome!',
                    style: TextStyle(
                      color: Color.fromRGBO(72, 72, 72, 1),
                      fontSize: 40,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ],
              ),
            ),
          ),
          Container(
            child: ListView(
              children: [
                InkWell(
                  onTap: () {
                    print('object2');
                  },
                  child: Container(
                    height: 60,
                    decoration: BoxDecoration(
                        color: Colors.white,
                        border: Border(
                            // 四个值 top right bottom left
                            top: BorderSide(
                                // 设置单侧边框的样式
                                color: Color(0xffEDEDED),
                                width: 5,
                                style: BorderStyle.solid),
                            bottom: BorderSide(
                                // 设置单侧边框的样式
                                color: Color(0xffEDEDED),
                                width: 5,
                                style: BorderStyle.solid))),
                    child: Padding(
                      padding: const EdgeInsets.only(left: 10, right: 10),
                      child: Center(
                        child: Text(
                          '切换账号',
                          style: TextStyle(
                            fontWeight: FontWeight.bold,
                            color: Color.fromRGBO(72, 72, 72, 1),
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
                InkWell(
                  onTap: () {
                    print('object2');
                  },
                  child: Container(
                    height: 50,
                    decoration: BoxDecoration(
                        color: Colors.white,
                        border: Border(
                            // 四个值 top right bottom left
                            bottom: BorderSide(
                                // 设置单侧边框的样式
                                color: Color(0xffEDEDED),
                                width: 1,
                                style: BorderStyle.solid))),
                    child: Padding(
                      padding: const EdgeInsets.only(left: 10, right: 10),
                      child: Center(
                        child: Text(
                          '退出',
                          style: TextStyle(
                            fontWeight: FontWeight.bold,
                            color: Color.fromRGBO(72, 72, 72, 1),
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
